If Not Retdata = vbNullString Then DialogRetData = Retdata 'If the user choose to open a file set this to the return
Unload Me 'Done
End Sub
Private Sub Form_Unload(Cancel As Integer)
'Nothing here, the opendialog is a child, so closed with main window (if still open)
End Sub
Private Sub LstRecentFiles_DblClick()
If AllowClick = True Then 'If the user dblclicked an item it is set to true by LstRecentFiles_MouseDown
CmdOpen_Click
End If
End Sub
Private Sub LstRecentFiles_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
On Error Resume Next
If Not Me.LstRecentFiles.HitTest(x, y).Text = vbNullString Then 'Check if the user clicked an item
AllowClick = True 'Yes
End If
If Err Then AllowClick = False 'No
End Sub
Private Sub TabStrip_Click()
If Me.TabStrip.Tabs(1).Selected Then
'
'Templates
'
SetActiveWindow Me.hwnd
Me.FrmOpenWindow.Visible = False
Me.FrmRescent.Visible = True
Me.LstRecentFiles.View = lvwIcon
Me.LstRecentFiles.ListItems.Clear
' Add some items
Set Mitem = Me.LstRecentFiles.ListItems.Add(, , "Empty Project", 1)
Mitem.SubItems(1) = "::New"
Set Mitem = Me.LstRecentFiles.ListItems.Add(, , "Example Project 1", 2)
Mitem.SubItems(1) = "::Sample1"
Set Mitem = Me.LstRecentFiles.ListItems.Add(, , "Example Project 2", 3)
Mitem.SubItems(1) = "::Sample2"
If Me.LstRecentFiles.ListItems.Count > 0 Then 'Select an item in the list, looks nicer
Me.LstRecentFiles.ListItems(1).Selected = True
End If
ElseIf Me.TabStrip.Tabs(2).Selected Then
'
'Open File
'
'Drawn at startup
'
Me.FrmOpenWindow.Visible = True
Me.FrmRescent.Visible = False
ElseIf Me.TabStrip.Tabs(3).Selected Then
'
'RecentFiles
'
Me.FrmOpenWindow.Visible = False
Me.FrmRescent.Visible = True
Dim Filename As String
Dim FileCaption As String
Dim i As Integer
Me.LstRecentFiles.ListItems.Clear
Me.LstRecentFiles.View = lvwReport
For i = 1 To GetRescentFiles(vbNullString, vbNullString, 0) 'Get the recent files from the registry
Call GetRescentFiles(Filename, FileCaption, i)
Set Mitem = Me.LstRecentFiles.ListItems.Add(, , FileCaption)
Mitem.SubItems(1) = Filename
Next
If Me.LstRecentFiles.ListItems.Count > 0 Then 'Select an item in the list, looks nicer
Me.LstRecentFiles.ListItems(1).Selected = True
End If
End If
End Sub
Private Sub TmrSetWindow_Timer()
Dim OpdlghWnd As Long 'Variable for OpenDialogs hWnd
OpdlghWnd = FindWindow(vbNullString, TempCaption) 'Search the window
If OpdlghWnd <> 0 Then 'Must been creaded, just i case...
Me.TmrSetWindow.Enabled = False 'Turn off the timer function, only once
Dim TmpRec As RECT 'Use to repossion the dialog
SetParent OpdlghWnd, Me.FrmOpenWindow.hwnd 'Make it as a child in the Picture box
GetWindowRect OpdlghWnd, TmpRec 'Get the size of the window
SetWindowPos OpdlghWnd, 0, -4, -1 * TitleBarHeight, TmpRec.Right - TmpRec.Left, TmpRec.Bottom - TmpRec.Top, 0 'Make the window in top of the box and cover the outher lines